import numpy as np
import base_api
import pickle
from net_config import * 
from utils import *
from utils import cim_linear 
def relu(x): 
    return np.maximum(0,np.minimum(127,x))

########################
#  Init device
########################
obj = base_api.BaseAPI()
chipNum = 1
#obj.Initdev()
# obj.selectChip(chipNum)
########################
#  prepare Input
########################
f = open('./input_test_binary.pkl','rb')
input = pickle.load(f)
f = open('./label_test_binary.pkl','rb')
label = pickle.load(f)

input1 = input['input'][0,0,:,:].astype(np.int8).reshape([1,-1])

out1 = cim_linear(obj,input1, net_config['layer1'])
out2 = relu(out1)
out3 = cim_linear(obj,out2,  net_config['layer2'])


print(out3)
print("finish")
